package com.hzhr.iot.statis.controller;

import com.hzhr.iot.core.annotation.ApiImplicitInternalParams;
import com.hzhr.iot.core.annotation.Author;
import com.hzhr.iot.core.exception.ServiceException;
import com.hzhr.iot.statis.controller.base.BaseController;
import com.hzhr.iot.statis.model.deptMonthlyGasConsume.DeptMonthlyGasConsumeGetModel;
import com.hzhr.iot.statis.model.deptMonthlyGasConsume.dataSum.DeptMonthlyGasConsumeDataSumModel;
import com.hzhr.iot.statis.model.deptMonthlyGasConsume.monthDataSum.DeptMonthlyGasConsumeMonthDataSumModel;
import com.hzhr.iot.statis.service.DeptMonthlyGasConsumeService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import java.util.Map;

@Api(tags = "DeptMonthlyGasConsume", description = "部门月用气量")
@RestController
@RequestMapping(value = "")
public class DeptMonthlyGasConsumeController extends BaseController {
    @Autowired
    DeptMonthlyGasConsumeService deptMonthlyGasConsumeService;

    //region /dept-monthly-gas-consumes GET
    //region swagger响应码 : get
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功"),
    })
    //endregion
    //region swagger说明 : get
    @ApiOperation(value="查询登录用户管辖部门的月用气量情况", notes="查询登录用户管辖部门的月用气量情况  \n简介 : 查询登录用户管辖部门的月用气量情况  \n步骤 :  \n1. 查询登录用户的所有管辖部门：(√)  \n 使用GLOBAL方式调用部门服务获取用户管辖范围内的所有部门模型对象deptModelList_1，  \n 条件参数如下：  \n _like_resourceCode = 登录用户.userCode + '%'；  \n 然后提取deptModelList_1元素的id属性，得到id属性集合deptIdlist_1；  \n2. 查询管辖部门的月用气量：(√)  \n 根据条件参数查询管辖部门的月用气量(DEPT_MONTHLY_GAS_CONSUME)对象集合deptMonthlyGasConsumeList_1及总数，  \n 额外筛选规则如下：  \n deptMonthlyGasConsumeList_1[i].deptId in deptIdlist_1；  \n3. 返回信息：(√)  \n 根据条件参数和查询到的deptMonthlyGasConsumeList_1及总数生成结果对象并返回；  \n",produces = "application/json")
    //endregion
    //region swagger参数 : get
    @ApiImplicitParams({
            @ApiImplicitParam(name = "token", value = "令牌",required = true, dataType = "string", paramType = "header"),

            @ApiImplicitParam(name = "show", value = "展示形式 one:展示一个,list:展示列表,null(空值):不展示", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "show_total", value = "是否展示总数", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "show_info", value = "是否展示详情", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "page", value = "页数", defaultValue = "1",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "count", value = "每页数量", defaultValue = "1",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "equal_deptId", value = "筛选条件 : where deptMonthlyGasConsume.deptId = #{equal_deptId}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "equal_companyId", value = "筛选条件 : where deptMonthlyGasConsume.companyId = #{equal_companyId}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "equal_gasUserType", value = "筛选条件 : where deptMonthlyGasConsume.gasUserType = #{equal_gasUserType}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "greaterthan_date", value = "筛选条件 : where deptMonthlyGasConsume.date > #{greaterthan_date}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "greaterthanorequal_date", value = "筛选条件 : where deptMonthlyGasConsume.date >= #{greaterthanorequal_date}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "lessthan_date", value = "筛选条件 : where deptMonthlyGasConsume.date < #{lessthan_date}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "lessthanorequal_date", value = "筛选条件 : where deptMonthlyGasConsume.date <= #{lessthanorequal_date}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "orderBy_date", value = "排序 : order by deptMonthlyGasConsume.date #{orderBy_date}",required = false, dataType = "string", paramType = "query"),

    })
    @ApiImplicitInternalParams({
            @ApiImplicitParam(name = "_token", value = "令牌",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-id", value = "用户编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-code", value = "用户代码",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-name", value = "用户名",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-company-id", value = "公司编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-dept-id", value = "部门编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-type", value = "用户类型(关联: common_service.options.code, typeCode = 'USER_TYPE')",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-transaction-id", value = "交易流水号",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-transaction-type", value = "交易类型",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-access-mode", value = "访问模式 0:一般 1:全局",defaultValue = "0", required = false, dataType = "int", paramType = "header"),

            @ApiImplicitParam(name = "_show", value = "展示形式 one:展示一个,list:展示列表,null(空值):不展示", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_show_total", value = "是否展示总数", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "_show_info", value = "是否展示详情", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "_is_paging", value = "是否分页", defaultValue = "true",required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "_page", value = "页数", defaultValue = "1",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "_count", value = "每页数量", defaultValue = "1",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "_equal_deptId", value = "筛选条件 : where deptMonthlyGasConsume.deptId = #{_equal_deptId}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "_equal_companyId", value = "筛选条件 : where deptMonthlyGasConsume.companyId = #{_equal_companyId}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "_equal_gasUserType", value = "筛选条件 : where deptMonthlyGasConsume.gasUserType = #{_equal_gasUserType}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_greaterthan_date", value = "筛选条件 : where deptMonthlyGasConsume.date > #{_greaterthan_date}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_greaterthanorequal_date", value = "筛选条件 : where deptMonthlyGasConsume.date >= #{_greaterthanorequal_date}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_lessthan_date", value = "筛选条件 : where deptMonthlyGasConsume.date < #{_lessthan_date}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_lessthanorequal_date", value = "筛选条件 : where deptMonthlyGasConsume.date <= #{_lessthanorequal_date}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_orderBy_date", value = "排序 : order by deptMonthlyGasConsume.date #{_orderBy_date}",required = false, dataType = "string", paramType = "query"),

    })
    //endregion
    //region 请求 : get
    @RequestMapping(value = "/dept-monthly-gas-consumes", method = RequestMethod.GET)
    //endregion
    @Author
    public ResponseEntity<DeptMonthlyGasConsumeGetModel> get(@RequestParam @ApiIgnore Map<String, Object> query) throws ServiceException {
        DeptMonthlyGasConsumeGetModel responseBody = deptMonthlyGasConsumeService.get(initHeader(), query);
        return new ResponseEntity<>(responseBody, HttpStatus.OK);
        //endregion
    }
    //endregion
    //region /dept-monthly-gas-consumes/data-sum GET
    //region swagger响应码 : getDataSum
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功"),
    })
    //endregion
    //region swagger说明 : getDataSum
    @ApiOperation(value="查询登录用户管辖部门的月用气量总和", notes="查询登录用户管辖部门的月用气量总和  \n简介 : 查询登录用户管辖部门的月用气量总和  \n步骤 :  \n1. 查询登录用户的所有管辖部门：(√)  \n 使用GLOBAL方式调用部门服务获取用户管辖范围内的所有部门模型对象deptModelList_1，  \n 条件参数如下：  \n _like_resourceCode = 登录用户.userCode + '%'；  \n 然后提取deptModelList_1元素的id属性，得到id属性集合deptIdlist_1；  \n2. 查询管辖部门的月用气量总和：(√)  \n 根据条件参数查询管辖部门的月用气量(DEPT_DAILY_GAS_CONSUME)对象集合deptMonthlyGasConsumeList_1元素的data属性的总和dataSum，  \n 额外筛选规则如下：  \n deptMonthlyGasConsumeList_1[i].deptId in deptIdlist_1；  \n3. 返回信息：(√)  \n 生成结果对象result，设置属性并返回，  \n 属性设置规则：  \n result.dataSum = dataSum；  \n",produces = "application/json")
    //endregion
    //region swagger参数 : getDataSum
    @ApiImplicitParams({
            @ApiImplicitParam(name = "token", value = "令牌",required = true, dataType = "string", paramType = "header"),

            @ApiImplicitParam(name = "equal_deptId", value = "筛选条件 : where deptDailyGasConsume.deptId = #{equal_deptId}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "equal_companyId", value = "筛选条件 : where deptDailyGasConsume.companyId = #{equal_companyId}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "equal_gasUserType", value = "筛选条件 : where deptDailyGasConsume.gasUserType = #{equal_gasUserType}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "greaterthan_date", value = "筛选条件 : where deptDailyGasConsume.date > #{greaterthan_date}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "greaterthanorequal_date", value = "筛选条件 : where deptDailyGasConsume.date >= #{greaterthanorequal_date}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "lessthan_date", value = "筛选条件 : where deptDailyGasConsume.date < #{lessthan_date}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "lessthanorequal_date", value = "筛选条件 : where deptDailyGasConsume.date <= #{lessthanorequal_date}",required = false, dataType = "string", paramType = "query"),
    })
    @ApiImplicitInternalParams({
            @ApiImplicitParam(name = "_token", value = "令牌",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-id", value = "用户编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-code", value = "用户代码",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-name", value = "用户名",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-company-id", value = "公司编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-dept-id", value = "部门编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-type", value = "用户类型(关联: common_service.options.code, typeCode = 'USER_TYPE')",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-transaction-id", value = "交易流水号",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-transaction-type", value = "交易类型",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-access-mode", value = "访问模式 0:一般 1:全局",defaultValue = "0", required = false, dataType = "int", paramType = "header"),

            @ApiImplicitParam(name = "_equal_deptId", value = "筛选条件 : where deptDailyGasConsume.deptId = #{_equal_deptId}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "_equal_companyId", value = "筛选条件 : where deptDailyGasConsume.companyId = #{_equal_companyId}",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "_equal_gasUserType", value = "筛选条件 : where deptDailyGasConsume.gasUserType = #{_equal_gasUserType}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_greaterthan_date", value = "筛选条件 : where deptDailyGasConsume.date > #{_greaterthan_date}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_greaterthanorequal_date", value = "筛选条件 : where deptDailyGasConsume.date >= #{_greaterthanorequal_date}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_lessthan_date", value = "筛选条件 : where deptDailyGasConsume.date < #{_lessthan_date}",required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_lessthanorequal_date", value = "筛选条件 : where deptDailyGasConsume.date <= #{_lessthanorequal_date}",required = false, dataType = "string", paramType = "query"),
    })
    //endregion
    //region 请求 : getDataSum
    @RequestMapping(value = "/dept-monthly-gas-consumes/data-sum", method = RequestMethod.GET)
    //endregion
    @Author
    public ResponseEntity<DeptMonthlyGasConsumeDataSumModel> getDataSum(@RequestParam @ApiIgnore Map<String, Object> query) throws ServiceException {
        DeptMonthlyGasConsumeDataSumModel responseBody = deptMonthlyGasConsumeService.getDataSum(initHeader(), query);
        return new ResponseEntity<>(responseBody, HttpStatus.OK);
        //endregion
    }
    //endregion
    //region /dept-monthly-gas-consumes/month-data-sum GET
    //region swagger响应码 : getMonthDataSum
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功"),
    })
    //endregion
    //region swagger说明 : getMonthDataSum
    @ApiOperation(value="查询部门的月用气量每月总和", notes="查询部门的月用气量每月总和  \n简介 : 查询部门的月用气量每月总和  \n",produces = "application/json")
    //endregion
    //region swagger参数 : getMonthDataSum
    @ApiImplicitParams({
            @ApiImplicitParam(name = "token", value = "令牌",required = true, dataType = "string", paramType = "header"),

            @ApiImplicitParam(name = "deptId", value = "部门编号",required = true, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "greaterthanorequal_date", value = "筛选条件 : where DeptDailyGasConsumeModel.date >= #{greaterthanorequal_date}",required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "lessthan_date", value = "筛选条件 : where DeptDailyGasConsumeModel.date < #{lessthan_date}",required = true, dataType = "string", paramType = "query"),
    })
    @ApiImplicitInternalParams({
            @ApiImplicitParam(name = "_token", value = "令牌",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-id", value = "用户编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-code", value = "用户代码",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-name", value = "用户名",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-company-id", value = "公司编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-dept-id", value = "部门编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-type", value = "用户类型(关联: common_service.options.code, typeCode = 'USER_TYPE')",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-transaction-id", value = "交易流水号",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-transaction-type", value = "交易类型",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-access-mode", value = "访问模式 0:一般 1:全局",defaultValue = "0", required = false, dataType = "int", paramType = "header"),

            @ApiImplicitParam(name = "_deptId", value = "部门编号",required = true, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "_greaterthanorequal_date", value = "筛选条件 : where DeptDailyGasConsumeModel.date >= #{_greaterthanorequal_date}",required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_lessthan_date", value = "筛选条件 : where DeptDailyGasConsumeModel.date < #{_lessthan_date}",required = true, dataType = "string", paramType = "query"),
    })
    //endregion
    //region 请求 : getMonthDataSum
    @RequestMapping(value = "/dept-monthly-gas-consumes/month-data-sum", method = RequestMethod.GET)
    //endregion
    @Author
    public ResponseEntity<DeptMonthlyGasConsumeMonthDataSumModel> getMonthDataSum(@RequestParam @ApiIgnore Map<String, Object> query) throws ServiceException {
        DeptMonthlyGasConsumeMonthDataSumModel responseBody = deptMonthlyGasConsumeService.getMonthDataSum(initHeader(), query);
        return new ResponseEntity<>(responseBody, HttpStatus.OK);
        //endregion
    }
    //endregion
}









































































































































































































































































































































































































